package model;

import java.util.List;
import java.util.Map;

public class ArrayDeclared implements StatementKind, Comparable<ArrayDeclared>{
//	private final Class<?> clazz;
	  private final Class<?> elementType;
	  private final Class<?> cls;
	public ArrayDeclared(Class<?> cls){
		this.cls=cls;
		this.elementType = cls.getComponentType();
	}
	  public static ArrayDeclared getArray(Class<?> cls) {
		    return new ArrayDeclared(cls);
		  }

	  public String convertString(){
		  return this.toString1(this.cls);
	  }
	  @Override
	  public String toString() {
	    return convertString();
	  }
	  public Class<?>  getArray() {
		  return this.cls;
	  }
	  public Class<?> getOutputType() {
		  return this.cls;
	  }
	  public  String toParseableString(Map<String,Class<?>> classesToTest){
		  if(classesToTest.containsKey(this.cls.getName()))
			 	return toString1(this.cls);		
		 return null;


	  }
	  public List<Class<?>> getInputTypes() {
		  return null;
	  }
	  public  String toString1(Class<?> cls) {
		     StringBuilder sb = new StringBuilder();
		     sb.append(this.elementType+"[] ");		     
		     sb.append("anArray "+  "  ");
		     return sb.toString();
		   }
      public  List<Class<?>> getGenericInputRetrnTypes(){
          return null;
  }
      
		@Override
		public int compareTo(ArrayDeclared o) {
			Class<?> thisClass=this.getOutputType();
			final int compareClazz = thisClass.getName().compareTo(o.getOutputType().getName());
			if(compareClazz != 0) return compareClazz;


			return 0;
		}
}
